Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: remove unneeeded Uri / UriBuilder allocations #1914

Closed

Conversation

TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Nov 5, 2024

Experiment: move query logic from RequestBuilderImplementation to RestMethodInfo, ecaping as needed.

Demonstrates some suspiciously good memory savings. I imagine this is from not allocating Uri 56 bytes, UriBuilder 88 bytes and calling various Uri methods (variable around 600 bytes). Unfortunately, this is broken under ceratin conditions 🤷 This can be fixed but will require rigorous testing.

Updated (on battery power)

Method Mean Error StdDev Median Gen0 Allocated
ConstantRouteAsync 5.581 us 0.5362 us 1.581 us 5.747 us 0.2060 1.91 KB
DynamicRouteAsync 7.694 us 0.8794 us 2.565 us 7.492 us 0.2289 2.12 KB
ComplexDynamicRouteAsync 10.209 us 0.9911 us 2.922 us 10.531 us 0.2594 2.45 KB
ObjectRequestAsync 15.595 us 2.4077 us 7.099 us 14.759 us 0.3052 3.34 KB
ComplexRequestAsync 23.063 us 0.8777 us 2.343 us 22.049 us 0.9766 9.1 KB

Old

Method Mean Error StdDev Median Gen0 Allocated
ConstantRouteAsync 4.255 us 0.1537 us 0.4507 us 4.422 us 0.2823 2.63 KB
DynamicRouteAsync 4.636 us 0.4640 us 1.3682 us 4.908 us 0.3128 2.91 KB
ComplexDynamicRouteAsync 4.039 us 0.0492 us 0.0437 us 4.045 us 0.3586 3.32 KB
ObjectRequestAsync 4.909 us 0.6689 us 1.8755 us 4.050 us 0.4730 4.35 KB
ComplexRequestAsync 11.812 us 0.0539 us 0.0478 us 11.799 us 1.1292 10.38 KB

dotMemory profile - Divide memory value by 1000 to get the actual allocations

image

@TimothyMakkison TimothyMakkison changed the title feat: remove unneeeded Uri / UriBuilder allocations POC: remove unneeeded Uri / UriBuilder allocations Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant